<?php
/**
 * Created by PhpStorm.
 * User: eugene
 * Date: 2018/5/15
 * Time: 10:11
 */

namespace App\Repos;


use App\Models\Cards;
use App\Models\UserDrawLotsLog;

class CardRepo
{
    
    public static function checkIsFull($user_id,$series_id)
    {
        $full_count = Cards::where('card_series_id',$series_id)->count();
        $user_hold = UserDrawLotsLog::where('user_id',$user_id)
            ->where('card_series_id',$series_id)->distinct('card_id')->count('card_id');
        
        return $user_hold >= $full_count;
    }
}